#coding:utf-8
from Tkinter import *
import tkFileDialog
import SysTrayIcon
import os
import win32api
import win32con
import win32gui_struct
try:
    import winxpgui as win32gui
except ImportError:
    import win32gui

class App(Frame):
    def __init__(self,master):
        Frame.__init__(self,master=master)
        self.master.title("BakaBka")
        self.top = self.winfo_toplevel()
        self.master=master
        self.files=[]
        self.master.geometry('%dx%d+%d+%d' % (300,500,0,100))
        self.hwnd = eval(self.master.wm_frame())

class Section():
    def add_(self):
            diaFileWindows = tkFileDialog.askopenfilename(parent=root,initialdir="/",title='Choose a Exe.')
    def del_(self):
            pass
    def quit_(self):
        quit()
def popumenu(event):
    m.post(event.x_root, event.y_root)
def move(event):
    global x,y
    new_x = (event.x-x)+root.winfo_x()
    new_y = (event.y-y)+root.winfo_y()
    s = "200x400+" + str(new_x)+"+" + str(new_y)
    root.geometry(s)
    #print("s = ",s)
    #print(root.winfo_x(),root.winfo_y())
    #print(event.x,event.y)
    #print()

if __name__=='__main__':
    x, y = 0, 0
    root=Tk()
    section=Section()

    canvas = Canvas(root)
    canvas.configure(highlightthickness = 0)
    canvas.pack()
    #root.overrideredirect(True)
    canvas.bind("<B1-Motion>",move)

    m = Menu(root,tearoff=0)
    m.add_command(label="添加",command=section.add_)
    m.add_separator()
    m.add_command(label="删除",command=section.del_)
    m.add_separator()
    m.add_command(label="退出",command=section.quit_)
    m.add_separator()


    canvas.bind("<Button-3>",popumenu)
    app=App(root)
    app.mainloop()
